import http from '../utils/request.js'


/**
 * @des 获取Rtmp
 * @param params{ place ,serialNumber}
 **/
export function getRtmp(params) {
    return http({
        url: '/rtmp',
        method: 'get',
        params
    })
}

/**
 * @des 获取RtmpList
 * @param params{place}
 *
 **/
export function getRtmpList(params) {
    return http({
        url: '/rtmp',
        method: 'get',
        params
    })
}

/**
 * @des 添加摄像头
 * @param data
 * {
    "ip": "192.168.1.91", //摄像头ip
    "username": "admin", //摄像头用户名称
    "password": "hjex2020", //摄像头密码
    "channel": "33", // 摄像头通道数
    "stream": "main", // 摄像头码流
    "place": "3030", //摄像头所在地点
    "serialNumber": "001" //摄像头序列号
    }
 **/
export function addWebcam(data) {
    return http({
        url: '/camera/create',
        method: 'post',
        data
    })
}
/**
 * @des 修改摄像头
 * @param data
 * {
    "ip": "192.168.1.91", //摄像头ip
    "username": "admin", //摄像头用户名称
    "password": "hjex2020", //摄像头密码
    "channel": "33", // 摄像头通道数
    "stream": "main", // 摄像头码流
    "place": "3030", //摄像头所在地点
    "serialNumber": "001" //摄像头序列号
    }
 **/
export function updateWebcam(data) {
    return http({
        url: '/camera/update',
        method: 'put',
        data
    })
}

/**
 * 获取摄像头
 * @param id 摄像头id
 */
export function getWebcam(id) {
    return http({
        url: `/camera/get/${id}`,
        method: 'get'
    })
}

/**
 * 分页获取摄像头
 * @param params {current,size,}
 */
export function getWebcamPage(params) {
    return http({
        url: `/camera/page`,
        method: 'get',
        params
    })
}

/**
 * 删除摄像头
 * @param id 
 */
export function deleteWebcam(id) {
    return http({
        url: `/camera/delete/${id}`,
        method: 'delete'
    })
}

